import java.util.Scanner;

/**
 * @author ：wang-ting
 * @Date：2025/3/19 15:58
 */

public class NarcissisticNumber {
    /**
     * 输入一个数，判断它是否是水仙花数
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = n;
        int sum = 0;
        int k = 0;//用来存放个位
        while (n > 0) {
            k = n % 10;
            k = k * k * k;
            sum += k;
            n = n / 10;
        }
        if (sum == count) {
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}
